// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   QNA2B26.java

package org.quickserver.net.GB268753QN.controlSzgw;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.quickserver.net.model.*;
import org.quickserver.net.server.ClientHandler;
import org.quickserver.util.data.dataProcessing;
import org.quickserver.util.state.QNA2B24State;

public class QNA2B3
{

    public QNA2B3()
    {
    }

    public static List<GB268753QNSZGW> QNA2B3OBJ(ClientHandler handler, String strs[],String ydz)
    {
    	// 获取设备码
    	String uniCode=dataProcessing.hexTo10StrAll(ydz);
    	GBServerDataSZGW ec = (GBServerDataSZGW)handler.getClientData();
        ec.setUniqueCode(uniCode);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 获取应用数据单元条数
        int total = dataProcessing.hexStringToInt10(strs[1]);
        List<GB268753QNSZGW> Glist = new ArrayList<GB268753QNSZGW>();
        for(int i = 0; i < total; i++)
        {
        	// 根据每条长度
        	int fors = i * 16;
        	String stateTime[] = new String[6];
            stateTime[0] = strs[12 + fors];
            stateTime[1] = strs[13 + fors];
            stateTime[2] = strs[14 + fors];
            stateTime[3] = strs[15 + fors];
            stateTime[4] = strs[16 + fors];
            stateTime[5] = strs[17 + fors];
            // 系统类型标志
            String sysType[] = new String[1];
            sysType[0] = strs[2 + fors];
            // 系统地址
            String sysAddress[] = new String[1];
            sysAddress[0] = strs[3 + fors];
            // 部件类型
            String componentType[] = new String[1];
            componentType[0] = strs[4 + fors];
            // 部件地址
            String componentAddress[] = new String[1];
            componentAddress[0] = strs[8 + fors] + strs[7 + fors] + strs[6 + fors] + strs[5 + fors];
            // 模拟量类型
            String moniType[] = new String[1];
            moniType[0] = strs[9 + fors];
            // 模拟量值
            String moniValue[] = new String[1];
            moniValue[0] = strs[11 + fors] + strs[10 + fors];
            // 封装
            GB268753QNSZGW SZGW = new GB268753QNSZGW();
            SZGW.setId(ec.getUniqueCode());
            SZGW.setUniqueCode(ec.getUniqueCode());
            SZGW.setUploadTime(sdf.format(new Date()));
            SZGW.setStateTime(dataProcessing.strsToTime(stateTime));
            SZGW.setSysType(dataProcessing.hexStringToInt10(sysType[0]) + "");
            SZGW.setSysAddress(dataProcessing.hexStringToInt10(sysAddress[0]) + "");
            SZGW.setComponentType(dataProcessing.hexStringToInt10(componentType[0]) + "");
            SZGW.setComponentAddress(dataProcessing.strTo10StrAll(componentAddress[0]));
            SZGW.setMoniType(dataProcessing.hexStringToInt10(moniType[0]) + "");
            SZGW.setMoniValue(dataProcessing.strTo10StrAll(moniValue[0]));
            Glist.add(SZGW);
        }
        
        Object obj = GBServerDataAll.devMap.get(uniCode);
        if(obj != null)
            ec.setDevType(obj.toString());
        GBServerDataAll.handlerMap.put(uniCode, handler);
        return Glist;
    }
}
